package view.WelcomePanels.SubPanels.MainButtonPanels;

import domain.WelcomeController;
import dto.*;
import java.awt.FlowLayout;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JPanel;
import view.HelperClasses.ImageButton;

/**
 *
 * @author Joachim
 */
public abstract class MainButtonPanel extends JPanel implements ActionListener {
    
    protected WelcomeDTO dto;
    protected WelcomeController controller;
    
    private String btnText;
    
    public MainButtonPanel(WelcomeDTO dto, WelcomeController controller, String btnText) {
        this.dto = dto;
        this.controller = controller;
        this.btnText = btnText;
        initPanel();
        addComponents();
    }
    
    private void initPanel() {
        this.setOpaque(false);
        this.setLayout(new FlowLayout(FlowLayout.CENTER,0,0));
    }
    
    private void addComponents() {
        JButton btn = new ImageButton(btnText, getClass().getResource("/resources/mainButton.png"));
        btn.addActionListener(this);
        this.add(btn);
    }
    
}
